home *** CD-ROM | disk | FTP | other *** search
/ Champak 142 / Volume 142 Oct 17 2011 - Damaged.iso / Games / rapid-fire.swf / scripts / __Packages / TimerControl.as < prev   
Text File  |  2011-10-17  |  747b  |  26 lines

  1. class TimerControl
  2. {
  3.    function TimerControl()
  4.    {
  5.       this.timer_init = _root.level_time * 1000;
  6.       this.timer_offset = getTimer();
  7.    }
  8.    function Update()
  9.    {
  10.       var _loc1_ = this;
  11.       var _loc2_ = _root;
  12.       _loc1_.time_disp = getTimer() - _loc1_.timer_offset;
  13.       _loc1_.level_time = (_loc1_.timer_init - (getTimer() - _loc1_.timer_offset)) / 1000;
  14.       _loc2_.timer_mc.gotoAndStop(Math.floor((1 - _loc1_.level_time / _loc2_.level_time) * 400));
  15.       if(_loc1_.level_time < 0)
  16.       {
  17.          _loc2_.paused = true;
  18.          _loc2_.attachMovie("level_end","level_end",_loc2_.pause_clip_depth);
  19.       }
  20.    }
  21.    function PauseOFF()
  22.    {
  23.       this.timer_offset = getTimer() - this.time_disp;
  24.    }
  25. }
  26.